package com.guigu.ssyx.product.api;

import com.guigu.ssyx.product.entity.Category;
import com.guigu.ssyx.product.entity.SkuInfo;
import com.guigu.ssyx.product.service.CategoryService;
import com.guigu.ssyx.product.service.SkuInfoService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/product/inner")
public class ProductInnnerController {

    @Autowired
    CategoryService categoryService;
    @Autowired
    SkuInfoService skuInfoService;

    @ApiOperation(value = "根据分类id获取分类")
    @GetMapping("getCategory/{categoryId}" )
    public Category getCategory(@PathVariable Long categoryId) {

        return categoryService.getById(categoryId);
    }


    @ApiOperation(value = "根据skuId获取sku信息" )
    @GetMapping("getSkuInfo/{skuId}" )
    public SkuInfo getSkuInfo(@PathVariable Long skuId) {

        return skuInfoService.getById(skuId);
    }


}
